<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	SettingForm form = (SettingForm)request.getAttribute("command");
%>

<div>
	<form id="userAddForm" target="_coreIframe"
		action="<%=request.getContextPath()%>/setting/doAddDevice">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>添加设备</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">设备名称:</td>
				<td><input class="inputText xs" name="deviceName"></td>
			</tr>
			<tr>
				<td class="tdTitle">序列号:</td>
				<td><input class="inputText xs" name="sn"></td>
			</tr>
			<tr>
				<td class="tdTitle">站点：</td>
				<td>
					<select id="siteList" class="inputText xs" name="siteId"  multiple="multiple">
						<option></option>
					</select>
				</td>
			</tr>			
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Setting.listDevice()">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<script type="text/javascript">
$(function() {
	$("#siteList").select2({
		language: "zh-CN",
	    minimumInputLength: 1,
	    ajax: {
	        url: global.contextPath +"/bar/sites",
	        dataType: "json",
	        type: "GET",
	        data: function (params) {
	            var queryParameters = {
	                term: params.term
	            }
	            return queryParameters;
	        },
	        processResults: function (data) {
	            return {
	                results: $.map(data, function (item) {
	                    return {
	                        text: item.text,
	                        id: item.id
	                    }
	                })
	            };
	        }
	    }
	});
});
</script>